package cn.blt.common;


import cn.blt.security.auth.entity.SysUser;
import cn.blt.single.UserSingle;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;


/**
 * 基本控制器
 * @author yuhag
 * @date 2022/08/26
 */
public abstract class BaseController {

    protected UserSingle userInfo(){
        return UserSingle.getInstance();
    }

    protected SysUser getUserInfo(){
        Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
        return (SysUser) authentication.getPrincipal();
    }

}
